﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using SQLToolbox.Controller.Tools;

namespace SQLToolbox.GUI
{
	/// <summary>
	/// Interaction logic for ConnectToDB.xaml
	/// </summary>
	public partial class ConnectToDBsForComparison : Window
	{
		ucConnectToDB ctdLeft, ctdRight;
		public ConnectToDBsForComparison()
		{
			InitializeComponent();
			ComparerController cc = new ComparerController();
			ctdLeft = new ucConnectToDB(cc, "ctdLeft");
			ctdRight = new ucConnectToDB(cc, "ctdRight");
			leftPlacholder.Children.Add(ctdLeft);
			rightPlacholder.Children.Add(ctdRight);
		}

		private void btnCompare_Click(object sender, RoutedEventArgs e)
		{

		}

		private void btnSwap_Click(object sender, RoutedEventArgs e)
		{
			string tDatasource, tServer, tDatabase = string.Empty;
			ConnectionCredentials tCC;

			tDatasource = ctdLeft.DataSource;
			tServer = ctdLeft.Server;
			tDatabase = ctdLeft.Database;
			tCC = ctdLeft.Credentials;

			ctdLeft.DataSource = ctdRight.DataSource;
			ctdLeft.Server = ctdRight.Server;
			ctdLeft.Database = ctdRight.Database;
			ctdLeft.Credentials = ctdRight.Credentials;

			ctdRight.DataSource = tDatasource;
			ctdRight.Server = tServer;
			ctdRight.Database = tDatabase;
			ctdRight.Credentials = tCC;

		}
	}
}
